"""
File: conftest.py
Author: ershixiong
Date: 2023/12/20
describe:

"""

from typing import List

import pytest

from hogwarts.Calculator.utils.log_utils import logger


@pytest.fixture(autouse=True)
def start_end():
    logger.info('开始计算')
    yield
    logger.info('结束计算')


@pytest.fixture(scope='session', autouse=True)
def end_log():
    yield
    logger.info('结束测试')




# def pytest_collection_modifyitems(
#         session: "Session", config: "Config", items: List["Item"]
# ) -> None:
#     print("pytest_collection_modifyitems called")
#     for item in items:
#         item.name = item.name.encode('utf-8').decode('unicode-escape')
#         item._nodeid = item.nodeid.encode('utf-8').decode('unicode-escape')

def pytest_collection_modifyitems(
        session: "Session", config: "Config", items: List["Item"]
) -> None:
    print("pytest_collection_modifyitems called")
    for item in items:
        item.name = item.name.encode('utf-8').decode('unicode-escape')
        item._nodeid = item.nodeid.encode('utf-8').decode('unicode-escape')
